#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

#define int long long
using namespace std;

typedef long long ll;
typedef double db;
typedef vector < int > vec;
typedef pair < int , int > pii;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

int solve(int x, int y) {
	if(x == y) return 0;
	if(x * y == 0) return x <= y ? y - x : x - y + 1;
	if(x >= 0 && y >= 0) return x <= y ? y - x : x - y + 2;
	if(x <= 0 && y <= 0) return x <= y ? y - x : x - y + 2;
	if(x <= 0 && y >= 0) return min(-x <= y ? y + x + 1 : -x - y + 1, y - x);
	if(x >= 0 && y <= 0) return -x <= y ? y + x + 1 : -x - y + 1;
}

signed main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
	int x = in, y = in;
	cout << solve(x, y) << endl; 
}
